<?php 

class ProductAction extends BaseAction{


	/**
	 * 首页
	 * @return [type] [description]
	 */
	function index(){
		$this->display();
	}

	/**
	 * 详情页
	 * @return [type] [description]
	 */
	function detail(){
		$id = I('id');
		$content = M('content')->where('id='.$id)->find();
		$this->assign('info',$content);
		$this->display();
	}

	/**
	 * 联系我们
	 * @return [type] [description]
	 */
	function contact(){
		$this->display();
	}

	/**
	 * 留言回复
	 */
	function feedback(){
		$name = I('Name');
		$email = I('Email');
		$message = I('Message');
		$tel = I('tel');
		$title = I('title');
		$r = M('message')->add(['username'=>$name,'email'=>$email,'content'=>$message,'tel'=>$tel,'title'=>$title,'posttime'=>time()]);
		if($r){
			$ret = ['status' => true, 'code' => 1000, 'msg' => 'Thank you for your message.'];
		}else{
			$ret = ['status' => false, 'code' => 1000, 'msg' => 'something error.'];
		}
		
        exit(json_encode($ret));
	}

	

}

?>